<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery-1.12.4.js"></script>
    <style>
        #back{position:fixed;right: 0;bottom:10px};
    </style>
</head>
<body style="height: 2000px;">
    111111111
    <input type="button" value="返回顶部" id="back">
    <script>
        $(function(){
            // scrollLeft() scrollTop()
            // $(window).scrollTop(400);//设置滚动条位置
            // $(window).scroll(function(){
            //     //获取滚动条
            //     console.log($(this).scrollTop());
            // });

            $('#back').click(function(){
                $(window).scrollTop(0);
            })
        })
    </script>
</body>
</html>